{include file="header.tpl.html" title="Products"}


<div class="content">
	<div class="inner-content">
		
		<h2>Import products</h2>
		
		{if $filename and !$errors}
			
			<p>{$filename} has successfully been {if $smarty.request.dryrun}verified{else}imported{/if}.</p>
			
		{else}
			
			<p>Browse for your product CSV file below, and upload.  If there are any errors, they'll be displayed so that you can fix them.</p>
			
			<form action="{$smarty.server.REQUEST_URI}" method="post" enctype="multipart/form-data" class="form">
				<input type="file" name="product_csv" id="product_csv" /> <button>Upload</button>
				
				<label for="dryrun"><input type="checkbox" name="dryrun" value="1" id="dryrun" {if $smarty.request.dryrun}checked="checked"{/if} /> Dryrun only - verify, but don't import any data.</label>
			</form>
			
			{if $errors}
				<h3>Errors</h3>
				<p>There were errors parsing the upload.  This file has <strong>NOT</strong> been imported.  Please try again.</p>
				<table class="table error-table">
					<tr>
						<th>Row</th>
						<th>Error(s)</th>
					</tr>
					{foreach from="`$errors`" key="row" item="errors"}
						<tr class="{cycle values=",alt"}">
							<td>{$row}</td>
							<td><ul>{foreach from="`$errors`" item="error"}
								<li>{$error}</li>
							{/foreach}</ul></td>
					{/foreach}
				</table>
			{/if}
			
		{/if}
		
	</div>
</div>

{include file="footer.tpl.html"}
